<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:p="http://primefaces.org/ui">

	<h:form id="edit">
		<h:panelGrid columns="2" style="margin:5px" >
			<h:outputText value="Solicitação:" style="margin:5px" />
			<h:inputTextarea value="#{orderMB.order.description}" style="width:550px; height:150px; margin:5px"/>
			
			<h:outputText value="Status do Pedido:" style="margin:5px" />
			<h:outputText value="Nova" style="margin:5px" />
			
			<h:outputText value="Prioridade:" style="margin:5px" />
			<p:selectOneMenu value="#{orderMB.order.priority}" style="margin:5px" >
				<f:selectItem itemLabel="Sem prioridade" itemValue="0" />
				<f:selectItem itemLabel="Alta"  itemValue="1" />
				<f:selectItem itemLabel="Média" itemValue="2" />
				<f:selectItem itemLabel="Baixa" itemValue="3" />
			</p:selectOneMenu>
			
			<h:outputText/>
			<p:commandButton value="Solicitar" action="#{orderMB.inserir()}"  process="@form" update="@form :contentForm:list"/>
			
		</h:panelGrid>
	</h:form>
	<h:form id="list">
		<h:outputText value="Retornos do Almox" style="font-weight:bold;" />
		<p:commandButton value="Atualizar" action="#{orderMB.atualiza()}"  process="@form" update="@form :contentForm:list"/>
		<p:dataTable id="listValues" var="p" value="#{orderMB.values}">
			<p:column headerText="ID" style="width:30px">
				<h:outputText value="#{p.id}" />
			</p:column>
			<p:column headerText="Pedido" style="width:300px">
				<h:outputText value="#{p.description}" />			
			</p:column>
			<p:column headerText="Data/Hora" >
				<h:outputText value="#{p.date.time}">
					<f:convertDateTime pattern="dd/MM/yyyy - HH:mm:ss"/>
				</h:outputText>			
			</p:column>
			<p:column headerText="Prioridade" >
				<h:outputText value="#{almoxMB.getPrioridadeTexto(p.priority)}" />			
			</p:column>
			<p:column headerText="Carro de Retorno" >
				<h:outputText value="#{p.car}" />			
			</p:column>
			<p:column headerText="#" >
				<p:commandButton value="Confirmar" action="#{orderMB.enviarAPqp(p)}"  process="@form" update="@form :contentForm:list"/>
			</p:column>
		</p:dataTable>
	</h:form>
</html>